package com.aspose.cells;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

class zbmu {
   String a = "{BBE1A952-AA13-448e-AADC-164F8A28A991}";
   zbmw b;
   zbna c;
   String d;
   String e;
   String f;
   int g;
   long h;
   int i;
   boolean j;
   int k;
   boolean l;
   zbmy m;
   String n;
   String o;
   zbmv p;

   zbmu(zbmv var1) {
      this.p = var1;
      this.i = 0;
      this.j = true;
      this.k = 1;
      this.l = true;
   }

   WorksheetCollection a() {
      return this.p.a();
   }

   boolean b() {
      return this.g == 0;
   }

   boolean c() {
      return this.g == 1;
   }

   zbmw d() {
      if (null == this.b) {
         this.b = new zbmw();
      }

      return this.b;
   }

   public zbmy e() {
      if (null == this.m) {
         this.m = new zbmy(this);
      }

      return this.m;
   }

   public String f() {
      return this.d;
   }

   public void a(String var1) {
      this.d = var1;
   }

   public String g() {
      return this.e;
   }

   void h() {
      ArrayList var1 = this.e().a();
      PivotItemCollection var2 = this.i();
      if (var1 != null && var2 != null) {
         var1 = this.a(var1);
         zbmb var3 = null;
         PivotItem var4 = null;
         this.m = new zbmy(this);

         for(int var5 = 0; var5 < var1.size(); ++var5) {
            var3 = (zbmb)var1.get(var5);
            zbmx var6 = new zbmx(this.e());
            var6.c = var3.c;
            zase.y(2);
            var4 = var2.get(zbng.a(var3.a));
            if (var4 != null) {
               var6.a = var4.getIndex();
               var6.b = !var4.isHidden();
            }

            this.m.a(var6);
         }

      } else {
         this.p.b(this);
      }
   }

   private ArrayList a(ArrayList var1) {
      if (var1 == null) {
         return null;
      } else {
         HashMap var2 = new HashMap();
         zbmb var3 = null;
         boolean var4 = this.i == 0;
         com.aspose.cells.b.a.a.zd var5 = new com.aspose.cells.b.a.a.zd(new zbnn(var4, var2));
         int var6 = -1;

         for(int var7 = 0; var7 < var1.size(); ++var7) {
            var3 = (zbmb)var1.get(var7);
            if (var3.a != null) {
               var5.a(var3.a, var7);
            } else {
               var6 = var7;
            }
         }

         ArrayList var9 = new ArrayList();
         if (!var4 && var6 >= 0) {
            com.aspose.cells.b.a.a.ze.a(var9, var1.get(var6));
         }

         Iterator var8 = var5.f().iterator();

         while(var8.hasNext()) {
            com.aspose.cells.b.a.a.ze.a(var9, var1.get((Integer)var8.next()));
         }

         if (var4 && var6 >= 0) {
            com.aspose.cells.b.a.a.ze.a(var9, var1.get(var6));
         }

         return var9;
      }
   }

   PivotItemCollection i() {
      int var1 = this.j().getCount();
      if (var1 == 0) {
         return null;
      } else {
         zbmz var2 = null;
         Worksheet var3 = null;
         PivotTable var4 = null;

         for(int var5 = 0; var5 < var1; ++var5) {
            var2 = this.j().a(var5);
            var3 = this.j().b.a().a(var2.a());
            if (var3 != null) {
               var4 = var3.getPivotTables().get(var2.b());
               if (var4 != null) {
                  PivotField var6 = var4.getBaseFields().get(this.g());
                  if (var6 != null) {
                     return var6.getPivotItems();
                  }
               }
            }
         }

         return null;
      }
   }

   public zbna j() {
      if (null == this.c) {
         this.c = new zbna(this);
      }

      return this.c;
   }

   void k() {
      if (this.d().getCount() != 0) {
         for(int var1 = 0; var1 < this.a().getCount(); ++var1) {
            Worksheet var2 = this.a().get(var1);

            for(int var3 = 0; var3 < this.b.getCount(); ++var3) {
               var2.d().b(this.b.a(var3));
               --var3;
            }
         }

         this.b.clear();
      }
   }
}
